package com.hkbigdata.transfrom;

import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @author liuanbo
 * @creat 2023-04-12-20:20
 * @see 2194550857@qq.com
 */
public class Flink01_TransForm_Map_Anonymous {
    public static void main(String[] args) throws Exception {
        //1.创建环境
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);

        //2.map
/*
        env.fromElements(1,2,3,4,5)
                .map(new MapFunction<Integer, Integer>() {
                    @Override
                    public Integer map(Integer value) throws Exception {
                        return value*value;
                    }
                }).print();
*/

env.fromElements(1,2,4,5)
        .map(data->data*data)
        .print();

        //3.
        env.execute();
    }
}
